package com.yx.security.core.validate.core;

import com.yx.security.core.properties.SecurityPropeties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author ltb
 **/
@Configuration
public class ValidateCodeBeanConfig {


    @Autowired
    private SecurityPropeties securityPropeties;

    @Bean
    @ConditionalOnMissingBean(name = "imageCodeGenerator")
    public ValidateCodeGenerator imageCodeGenerator() {
        ImageCodeGenerator codeGenerator = new ImageCodeGenerator();
        codeGenerator.setSecurityPropeties(securityPropeties);
        return codeGenerator;
    }
}
